#!/usr/bin/env python
# encoding: utf-8
"""
DRIDETest.py

Tests for the DRIDE class.

Created by Alakazam on 2008-05-26.
Copyright (c) 2008. All rights reserved.
"""

import unittest
import DRIDE

class DRIDETest(unittest.TestCase):
  def setUp(self):
    self.n         = 1000
    self.outputDim = 2

    self.dride = DRIDE.DRIDE(n=self.n, outputDim=self.outputDim)

  def testReductionNone(self):
    self.dride.reducer = "None"

    self.dride.doReduction()

    self.assertEqual(self.dride.outputData.shape, (self.n, self.outputDim))

  def testReductionPCA(self):
    self.dride.reducer = "PCA"

    self.dride.doReduction()

    self.assertEqual(self.dride.outputData.shape, (self.n, self.outputDim))

  # TODO: Add test for Isomap algorithm that computes fast
  # A.reduce_isodata(isomap_type="e", e=5.0, O=2)
  # A.reduce_isodata(isomap_type="e", e=10.0, O=2)
  # A.reduce_isodata(isomap_type="K", K=10, O=2)
  # def testReductionIsomap(self):
  #   self.dride.reducer = "Isomap"
  #   
  #   self.dride.doReduction()
  #   
  #   self.assertEqual(self.dride.outputData.shape, (self.n, self.outputDim))

  def testReductionDiffusionMaps(self):
    self.dride.reducer = "DiffusionMaps"

    self.dride.doReduction()

    self.assertEqual(self.dride.outputData.shape, (self.n, self.outputDim))

if __name__ == '__main__':
  unittest.main()
